package com.net.oil.main.presenter;

import com.net.oil.base.BasePresenter;
import com.net.oil.main.bean.BannerShopBean;
import com.net.oil.main.bean.ShopListBean;
import com.net.oil.main.contract.ShopContract;
import com.net.oil.main.model.ShopModel;

import java.util.List;

/**
 * 作者：lch
 * 时间：2018/3/31:11:56
 * 邮箱：245850413@qq.com
 * 说明：
 */

public class ShopPresenter extends BasePresenter<ShopContract.View> implements ShopContract.Presenter {

    private ShopContract.View view;
    private ShopContract.Model model;

    public ShopPresenter(ShopContract.View view) {
        this.view = view;
        model = new ShopModel(this);
    }

    @Override
    protected void unSubscribe() {
        model.unSubscribe();
    }

    /**
     * 获取商家列表
     * @param province  省
     * @param city  城市
     * @param county    县/区
     * @param name  商家名称模糊查询
     * @param lng   当前位置纬度
     * @param lat   当前位置经度
     * @param page  页码
     * @param rows  分页大小
     */
    @Override
    public void getShopList(String province, String city, String county, String name, double lng, double lat, int page, int rows) {
        model.getShopList(province, city, county, name, lng, lat, page, rows);
    }

    /**
     * 获取商家列表成功
     * @param shopListBean  商家列表数据
     */
    @Override
    public void getShopListSuccess(ShopListBean shopListBean) {
        view.getShopListSuccess(shopListBean);
    }

    /**
     * 获取商家列表失败
     */
    @Override
    public void getShopListFailed() {
        view.getShopListFailed();
    }

    @Override
    public void getBannerShoList() {
        model.getBannerShopList();
    }

    @Override
    public void getBannerShopListSuccess(List<BannerShopBean> shopBeans) {
        view.getBannerShopListSuccess(shopBeans);
    }

    @Override
    public void getBannerShopListFailed() {
        view.getBannerShopListFailed();
    }
}
